<!--
 * @Author: YSM
 * @Description: 请填写当前文件简介
 * @Date: 2023-11-14 17:32:54
 * @LastEditTime: 2024-01-14 18:12:42
 * @FilePath: \shouxun-web-viewd:\work\my_web_knowledge\my_vue2_demo\src\views\Light\light.vue
-->
<template>
  <div>
    <button @click="startAnimation">开始闪电动画</button>
    <div class="lightning" v-if="showLightning" @transitionend="resetAnimation"></div>


  </div>
</template>

<script>
export default {
  data() {
    return {
      showLightning: false,
      examData: []
    };
  },
  methods: {
    startAnimation() {
      this.showLightning = true;
      setTimeout(() => {
        this.showLightning = false;
      }, 1000);
    },
    resetAnimation() {
      this.showLightning = false;
    }
  }
};
</script>

<style lang="less">
.info-title {
  font-size: 20px;
  font-weight: 600;
}






.lightning {
  width: 100px;
  height: 200px;
  background-color: yellow;
  animation: flash 0.5s infinite;
}

@keyframes flash {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}
</style>
